package com.tongda.core.common;

/**
 * 
 */

import android.os.Environment;

public class Constants {
	public static final int DESCRIBE = 1;
	public static final int RE_DESCRIBE = 2;
	public static final boolean DEBUG = true;
	public static final Object objectLock = new Object();
	public static final String SERVER_CONTEXT_PATH = "/canyin-frontdesk";
	public static final String SERVER_CONTEXT_PATHS = "/canyin-frontdesk";
	public static final String PACKAGE_STR = "com.tongda.order";
	public static final String MENU_PACKAGE_STR = "com.tongda.menu";
	public static final String APP_PATH = "aTongda";
	public static final String FILE_BASE_PATH = Environment
			.getExternalStorageDirectory().getAbsolutePath() + "/" + APP_PATH;
	public static String RESTAURANT_ID = "dadc3dd9-bdeb-11e2-824b-001b783bdd64";
	public static String SERVER_IP = "192.168.1.200";
	public static String SERVER_PORT = "8668";
	public static String PICTURES_SERVER_PORT = "8668";
	public static String BASE_SERVIER_URL = "http://" + SERVER_IP + ":"
			+ SERVER_PORT + SERVER_CONTEXT_PATH + "/";
	public static String BASE_SERVIER_URLS = "http://" + SERVER_IP + ":"
			+ PICTURES_SERVER_PORT + SERVER_CONTEXT_PATHS + "/";
	public static int MESSAGE_SERVER_PORT = 8080;
	public static boolean MESSAGE_AUTO_PUSH = false;
	public static boolean TABLE_STATUS_AUTO_REFRESH = false;

	/*
	 * 电子菜谱和点餐宝可共用的常量值
	 */
	public static final String CLIENT_ORDER = "canyin_order";
	public static final String CLIENT_MENU = "canyin_menu";
	public static final String USERNAME = "USER_NAME";
	public static final String PASSWORD = "PASSWORD";
	public static final String COOKIE = "cookie";
	public static final String SESSIONID = "session_id";
	// 用于拼接BaseService.COOKIE的字符串
	public static final String COOKIE_STR_USERNAME = "username=";
	public static final String COOKIE_STR_PASSWORD = ";password=";

	/*
	 * 电子菜谱中用到的常量值
	 */
	// 电子菜谱中用到的sharepreference数据的key值
	public static final String MENU_IS_REM_CURRENTUSER = "menu_is_remember_currentuser";
	public static final String MENU_RES_NAME = "rst_name";

	public static void resetServerIp(String serverIp) {
		if ("".equals(serverIp)) {
			return;
		}
		SERVER_IP = serverIp;
		BASE_SERVIER_URL = "http://" + SERVER_IP + ":" + SERVER_PORT
				+ SERVER_CONTEXT_PATH + "/";
		BASE_SERVIER_URLS = "http://" + SERVER_IP + ":" + PICTURES_SERVER_PORT
				+ SERVER_CONTEXT_PATHS + "/";
	}

	public static void resetServerPort(String serverPort) {
		if ("".equals(serverPort)) {
			return;
		}
		SERVER_PORT = serverPort;
		PICTURES_SERVER_PORT=serverPort;
		BASE_SERVIER_URL = "http://" + SERVER_IP + ":" + SERVER_PORT
				+ SERVER_CONTEXT_PATH + "/";
		BASE_SERVIER_URLS = "http://" + SERVER_IP + ":" + PICTURES_SERVER_PORT
				+ SERVER_CONTEXT_PATHS + "/";
	}

	public static void resetMessageAutoPush(boolean switchState) {
		MESSAGE_AUTO_PUSH = switchState;
	}

	public static void resetTableStatusAutoRefresh(boolean switchState) {
		TABLE_STATUS_AUTO_REFRESH = switchState;
	}
}
